﻿namespace Chaliy.Syndication.UnitTests.MediaRss
{
    using Xunit;
    using XunitExt;
    using Chaliy.Syndication.MediaRss;
    using System;

    public class When_Write_Media_Description
    {
        [Fact]
        public void Serializer_Should_Write_Description_Element()
        {
            MediaDescription raiting = new MediaDescription();

            raiting
                .ShouldMatchMedia("/media:description", "Description element SHOULD exists");
        }

        [Fact]
        public void Serializer_Should_Write_Scheme()
        {
            const MediaTextType etalonType = MediaTextType.Html;

            MediaDescription raiting
                = new MediaDescription
                {
                    Type = etalonType
                };

            raiting
                .ShouldMatchMedia("/media:description/@type", "Type attribute SHOULD exists")
                .Value.ShouldEqual("html");
        }

        [Fact]
        public void Serializer_Should_Not_Write_Plain_Type() // Because Plain is devault value
        {
            const MediaTextType plainType = MediaTextType.Plain;

            MediaDescription raiting
                = new MediaDescription
                {
                    Type = plainType
                };


            raiting
                .ShouldNotMatchMedia("/media:description/@type", "Scheme attribute SHOULD NOT exists");
        }
       
        [Fact]
        public void Serializer_Should_Write_Description_Value()
        {
            const string etaloneValue = "The Judy's - The Moo Song";

            MediaDescription raiting
                = new MediaDescription
                {
                    Value = etaloneValue
                };

            raiting
                .ShouldMatchMedia("/media:description", "Description element SHOULD exists")
                .Value.ShouldEqual(etaloneValue);
        }
    }
}
